home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / SciAn / src / ScianDraw.h < prev    next >
C/C++ Source or Header  |  1994-08-01  |  8KB  |  246 lines

  1. /*ScianDraw.h
  2.   External stuff for ScianDraw.c
  3.   Eric Pepke
  4.   March 28, 1990
  5. */
  6.  
  7. /*Structure to contain drawing state*/
  8. typedef struct
  9.     {
  10.     WinInfoPtr window;        /*Current window into which drawing is done*/
  11.     Bool initialWindow;        /*True iff initial window pressing*/
  12.     int origin[2];            /*Origin of the window*/
  13.     int viewport[4];        /*Viewport mapped to ortho or perspec*/
  14.     int screenMask[4];        /*Screen mask within window*/
  15.     int translation[2];        /*Translation within window*/
  16.     } DrawingState;            /*Drawing state*/
  17.  
  18. #define NDRAWINGSTATES        50    /*Maximum number of saved drawing states*/
  19. extern DrawingState drawingStates[NDRAWINGSTATES];
  20.                     /*Stack of drawing states*/
  21. extern int curDrawingStateIndex;    /*Current drawing state index*/
  22. extern Bool fullScreen;            /*True iff drawing into full screen*/
  23.  
  24. typedef struct
  25.     {
  26.     unsigned char alpha;
  27.     unsigned char blue;
  28.     unsigned char green;
  29.     unsigned char red;
  30.     } Pixel;
  31.  
  32. extern int imageSubSample;            /*Step for subsampling image*/
  33.  
  34. #define CURSTATE    (drawingStates[curDrawingStateIndex])
  35. #define LASTSTATE    (drawingStates[curDrawingStateIndex - 1])
  36. #define NEXTSTATE    (drawingStates[curDrawingStateIndex + 1])
  37.  
  38. extern Bool drawMouse;            /*True iff draw on next mouse*/
  39. extern int drawingMode;            /*Drawing mode*/
  40. extern FILE *drawFile;            /*File in which to draw*/
  41.  
  42. /* globals used for PostScript drawing */
  43. extern FILE *psFile;        /*temp drawing file*/
  44. extern int iconsUsed[];        /* icons used in EPS file */
  45. extern int numIconsUsed;    /* number used so far = next index to use */
  46.  
  47. #define IsDrawingRestricted(l, r, b, t) (                 \
  48.     (l) > CURSTATE . screenMask[1] - CURSTATE . translation[0] ||    \
  49.     (r) < CURSTATE . screenMask[0] - CURSTATE . translation[0] ||    \
  50.     (b) > CURSTATE . screenMask[3] - CURSTATE . translation[1] ||    \
  51.     (t) < CURSTATE . screenMask[2] - CURSTATE . translation[1])    \
  52.  
  53. #define PSM printf("Local mask = %d %d %d %d, bwana\n",         \
  54.     CURSTATE . screenMask[0] - CURSTATE . translation[0],        \
  55.     CURSTATE . screenMask[1] - CURSTATE . translation[0],        \
  56.     CURSTATE . screenMask[2] - CURSTATE . translation[1],        \
  57.     CURSTATE . screenMask[3] - CURSTATE . translation[1]);
  58.  
  59.  
  60. /*Values for drawing mode*/
  61. #define DRAW_SCREEN    1    /*Drawing to the screen*/
  62. #define DRAW_POSTSCRIPT    2    /*Drawing to a postscript file*/
  63.  
  64. /*Arrowhead styles*/
  65. #define AH_NO_ARROW    0
  66. #define AH_AT_START    1
  67. #define AH_AT_END    2
  68. #define AH_BOTH_ENDS    (AH_AT_START | AH_AT_END)
  69.  
  70. /*Method declarations*/
  71. ObjPtr PressObject();
  72.  
  73. #ifdef PROTO
  74. void BeginTranslucent(void);
  75. void BeginEvenOnly(void);
  76. void BeginOddOnly(void);
  77. void EndEvenOnly(void);
  78. void EndOddOnly(void);
  79. void EndTranslucent(void);
  80. void DrawObject(ObjPtr);
  81. ObjPtr KeyDownObject(ObjPtr obj, int key, long flags);
  82. void SetOrigin(int, int);
  83. void RestoreOrigin(void);
  84. void SetDrawingWindow(WinInfoPtr);
  85. void RestoreDrawingWindow();
  86. void SetSubPort(int, int, int, int);
  87. void RestoreSubPort(void);
  88. void SetClipRect(int, int, int, int);
  89. void RestoreClipRect(void);
  90. void ClipToMe(ObjPtr);
  91. void RegisterInSpace(Bool);
  92. void EndRegister(void);
  93. void CurOffset(int *, int *);
  94. ObjPtr DropObjects(ObjPtr, ObjPtr, int, int);
  95. void UpdateDrawing(void);
  96. void FrameUIRect(int, int, int, int, int);
  97. void FillUIRect(int, int, int, int, int);
  98. void FillUIGauzeRect(int, int, int, int, int);
  99. void FrameRect(int, int, int, int);
  100. void FillRect(int, int, int, int);
  101. void DrawUILine(int, int, int, int, int);
  102. void DrawUILine(int, int, int, int, int);
  103. void DrawLine(int, int, int, int);
  104. void DrawWFSphere(real, real, real, real);
  105. void FillSpaceRect(real x1, real y1, real z1,
  106.            real x2, real y2, real z2,
  107.            real x3, real y3, real z3,
  108.            real x4, real y4, real z4,
  109.            real nx, real ny, real nz);
  110. void FrameSpaceRect(real x1, real y1, real z1,
  111.            real x2, real y2, real z2,
  112.            real x3, real y3, real z3,
  113.            real x4, real y4, real z4);
  114. void DrawSpaceLine(real x1, real y1, real z1, real x2, real y2, real z2);
  115. void DrawSpaceString(real x, real y, real z, char *s);
  116. void DrawSpacePanelLine(real x1, real y1, real x2, real y2, real width, int arrow,
  117.                 real arrowParams[4][2]);
  118. void DrawVCursor(int, int, int);
  119. void FrameUIWideRect(int, int, int, int, int, int);
  120. void FrameWideRect(int, int, int, int, int);
  121. void DrawHandle(int, int);
  122. Bool PointInHandle(int, int, int, int);
  123. void MakeOrthoXform(void);
  124. void MakePickOrthoXform(void);
  125. void DrawRaisedEdge(int left, int right, int bottom, int top);
  126. void DrawSunkenEdge(int left, int right, int bottom, int top);
  127. void DrawInsetRect(int left, int right, int bottom, int top);
  128. void DrawRaisedRect(int left, int right, int bottom, int top, int uiColor);
  129. void DrawSunkenRect(int left, int right, int bottom, int top, int uiColor);
  130. void FillTri(int, int, int, int, int, int);
  131. void FillUITri(int, int, int, int, int, int, int);
  132. void SetLineWidth(int width);
  133. void SetPointWidth(int width);
  134. void DrawMarkerSplat(int, int, int, int);
  135. void DrawMarkerBlot(int, int, int, int);
  136. void DrawMarkerCheck(int, int, int, int);
  137. void DrawMarkerX(int, int, int, int);
  138. void FillUIWedge(int, int, int, int, int, int);
  139. void DrawArc(int, int, int, int, int);
  140. void FillUIDisc(int, int, int, int);
  141. void FillUIGauzeDisc(int, int, int, int);
  142. void DrawCtlLeft(int left, int right, int bottom, int top, int uiColor);
  143. void DrawCtlRight(int left, int right, int bottom, int top, int uiColor);
  144. void DrawCtlUp(int left, int right, int bottom, int top, int uiColor);
  145. void DrawCtlDown(int left, int right, int bottom, int top, int uiColor);
  146. void BeginDrawing(char *, int, int, int, int, real);
  147. void DrawPSFrame(char *, int, int, int, int);
  148. void EndDrawing(Bool);
  149. int RegisterIconUsed(int);
  150. void FillRealRect(real, real, real, real);
  151. void FrameRealWideRect(real, real, real, real, real);
  152. void FillRealQuad(real, real, real, real, real, real, real, real);
  153. void FillIntQuad(int, int, int, int, int, int, int, int);
  154. void InitDraw(void);
  155. void KillDraw(void);
  156. void FullScreen(Bool);
  157. void EraseAll(void);
  158. void SetOrthoPick(void);
  159. void RestoreOrthoPick(void);
  160. void SavePSImage(FILE *psFile, Pixel *imageBuffer, int, int, int, int);
  161. void PushTransformation(void);
  162. void PopTransformation(void);
  163. #else
  164. void BeginTranslucent();
  165. void EndTranslucent();
  166. void BeginEvenOnly();
  167. void BeginOddOnly();
  168. void EndEvenOnly();
  169. void EndOddOnly();
  170. void DrawObject();
  171. ObjPtr KeyDownObject();
  172. void SetDrawingWindow();
  173. void RestoreDrawingWindow();
  174. void SetSubPort();
  175. void RestoreSubPort();
  176. void SetClipRect();
  177. void RestoreClipRect();
  178. void SetOrigin();
  179. void RestoreOrigin();
  180. void ClipToMe();
  181. void RegisterInSpace();
  182. void EndRegister();
  183. Bool Mouse();
  184. ObjPtr DropObjects();
  185. void CurOffset();
  186. void UpdateDrawing();
  187. void FrameUIRect();
  188. void FillUIRect();
  189. void FillUIGauzeRect();
  190. void FrameRect();
  191. void FillRect();
  192. void DrawUILine();
  193. void DrawLine();
  194. void DrawWFSphere();
  195. void DrawSpaceLine();
  196. void DrawSpaceString();
  197. void DrawSpacePanelLine();
  198. void DrawVCursor();
  199. void FrameUIWideRect();
  200. void FrameWideRect();
  201. void DrawHandle();
  202. Bool PointInHandle();
  203. void MakeOrthoXform();
  204. void MakePickOrthoXform();
  205. void DrawRaisedEdge();
  206. void DrawSunkenEdge();
  207. void DrawInsetRect();
  208. void DrawRaisedRect();
  209. void DrawSunkenRect();
  210. void FillTri();
  211. void FillUITri();
  212. void SetLineWidth();
  213. void SetPointWidth();
  214. void DrawMarkerSplat();
  215. void DrawMarkerBlot();
  216. void DrawMarkerCheck();
  217. void DrawMarkerX();
  218. void FillUIWedge();
  219. void DrawArc();
  220. void FillUIDisc();
  221. void FillUIGauzeDisc();
  222. void DrawCtlLeft();
  223. void DrawCtlRight();
  224. void DrawCtlUp();
  225. void DrawCtlDown();
  226. void BeginDrawing();
  227. void DrawPSFrame();
  228. void EndDrawing();
  229. int RegisterIconUsed();
  230. void FillSpaceRect();
  231. void FrameSpaceRect();
  232. void FillRealRect();
  233. void FrameRealRect();
  234. void FillRealQuad();
  235. void FillIntQuad();
  236. void InitDraw();
  237. void KillDraw();
  238. void FullScreen();
  239. void EraseAll();
  240. void SetOrthoPick();
  241. void RestoreOrthoPick();
  242. void SavePSImage();
  243. void PushTransformation();
  244. void PopTransformation();
  245. #endif
  246.